/**
 * 车辆管理
 */
<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>车辆管理</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 搜索筛选 -->
    <el-form :inline="true" :model="pagination1" class="user-search">
      <el-form-item >
        <el-input size="medium" v-model="pagination1.userName" placeholder="昵称"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input size="medium" v-model="pagination1.tel" placeholder="手机号码"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input size="medium" v-model="pagination1.status" placeholder="车辆状态"></el-input>
      </el-form-item>
      <!-- <el-form-item>
        <el-select size="small" v-model="formInline.payType" placeholder="请选择">
          <el-option v-for="type in payType" :label="type.key" :value="type.value" :key="type.value"></el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item>
        <el-button size="small" type="primary" icon="el-icon-search" @click="selAllOrSelByLike">搜索</el-button>
      </el-form-item>
    </el-form>
    <!--列表-->
    <el-table size="small" :data="TCarList" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
      <el-table-column align="center" type="index" width="60">
      </el-table-column>
      <el-table-column  prop="licName" label="车牌号码" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column  prop="licType" label="车牌类型" width="100" show-overflow-tooltip>
        <template slot-scope="scope">
          <span v-if="scope.row.licType== 0">蓝牌</span>
          <span v-if="scope.row.licType== 1">黄牌</span>
          <span v-if="scope.row.licType== 2">黑牌</span>
          <span v-if="scope.row.licType== 3">绿牌</span>
          <span v-if="scope.row.licType== 4">白牌</span>
        </template>
      </el-table-column>
      <el-table-column  prop="userName" label="所属用户" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column  prop="totalNum" label="订单数量" width="100" show-overflow-tooltip>
      </el-table-column>
      <el-table-column  prop="nopayNum" label="未交费订单数量" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column  prop="totalMoney" label="消费金额" width="100" show-overflow-tooltip>
      </el-table-column>
      <el-table-column  prop="nopayMoney" label="待缴费金额" width="100" show-overflow-tooltip>
      </el-table-column>
      <el-table-column  prop="createTime" label="创建时间" width="160" show-overflow-tooltip>
      </el-table-column>
      <el-table-column align="center" label="操作" min-width="120">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.row.carId)" type="primary">订单记录</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
     <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pagination1.currentPage"
      :page-sizes="pagination2.pagesizes"
      :page-size="pagination1.pagesize"
      background
      layout="total, sizes, prev, pager, next, jumper"
      :total="pagination2.total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      TCarList:[],
      loading: false, //是显示加载
      formInline:{},
      pagination1:{
        pageSize:5,
        currentPage:1,
        userName:"",
        tel:"",
        status:""
      },
      pagination2:{
        total:0,
        pagesizes:[5,10,20,50,100]
      }
    }
  },
  methods: {
    selAllOrSelByLike() {
      this.$axios.post("/TCars/sel",this.pagination1)
      .then(res=>{
        this.TCarList = res.data.data.TCarList;
        this.pagination2.total = res.data.data.total;
      })
      .catch(error=>{
        console.log(error.data);
      })
    },
    handleSizeChange(val){
      this.pagination1.pagesize = val;
      this.pagination1.currentPage = 1;
      this.selAllOrSelByLike();
    },
    handleCurrentChange(val){
      this.pagination1.currentPage = val;
      this.selAllOrSelByLike();
    },
    handleEdit(carId){
      this.$router.push({name:'订单记录',query:{carId:carId}});
    }
    
  },  
  created(){
    this.selAllOrSelByLike();
  }

 
}
</script>

<style scoped>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
</style>

 
 

 